package one;

public class A005 {

    /**
     * 05：盛水最多的容器
     * @param args
     */
    public static void main(String[] args) {

    }

    public int maxArea(int[] height) {
        int ret=0;
        int left=0,right=height.length-1;
        while(left<right) {
            int cur = Math.min(height[left],height[right]) * (right-left); // 面积
            if(height[left]>height[right]) right--;
            else left++;
            ret = Math.max(ret,cur);
        }
        return ret;
    }
}
